/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.compomics.spectral.utilities.dataprovider.prideXML.errors.exceptions;

import com.compomics.spectral.utilities.dataprovider.prideXML.errors.enums.ConversionError;
import com.compomics.spectral.utilities.dataprovider.prideXML.extractor.PrideXMLToMGFConverter;
import org.apache.log4j.Logger;

/**
 *
 * @author Kenneth
 */
public class XMLConversionException extends Exception {

    /**
     * Logger (includes file appender to log errors)
     */
    private Logger logger = Logger.getLogger(PrideXMLToMGFConverter.class);
    /**
     * private error, only one per Exception
     */
    private ConversionError error;
    /**
     * A handler to temporarely store all the errors during this conversion
     */

    public XMLConversionException(ConversionError error) {
        this.error = error;
    }

    public ConversionError getError() {
        return this.error;
    }

    private XMLConversionException(String strMessage) {
        super(strMessage);
    }

    public String toString() {
        return error.getSeverityLevel() + " (" + error.getCode() + ") : " + error.getDescription();
    }

}
